package com.fpx.pc.data.listener;

import java.util.ArrayList;
import java.util.HashMap;

import com.fpx.pc.R;
import com.fpx.pc.data.entity.Post4pxInfo;

import android.content.Context;
import android.widget.ListAdapter;
import android.widget.SimpleAdapter;


public class InfoAdapter {
	private Post4pxInfo post4pxInfo;
	private ArrayList post4pxInfos;
	private Context context;
	
	
	public InfoAdapter(ArrayList post4pxInfos, Context context) {
		super();
		this.post4pxInfos = post4pxInfos;
		this.context = context;
	}


	public ListAdapter setListView() {
		// TODO Auto-generated method stub
		ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
		for (int i = 0; i < post4pxInfos.size(); i++) {
			post4pxInfo=new Post4pxInfo();
			post4pxInfo=(Post4pxInfo) post4pxInfos.get(i);
//    		do {
			HashMap<String, String> map = new HashMap<String, String>();
			map.put("time", post4pxInfo.getTime());
			map.put("address", post4pxInfo.getAddress());
			map.put("status", post4pxInfo.getStatus());
			System.out.println(post4pxInfo.toString());
			list.add(map);
//    		}while(false);
		}
//    	ListAdapter listAdapter=new SimpleAdapter(context,list, R.layout.info_content_item,
//    			new String[] { "time","status"}, new int[] { R.id.info_txt_left,R.id.info_txt_right});
//    	ListAdapter listAdapter=new SimpleAdapter(context,list, R.layout.info_content_item,
//    			new String[] { "time", "address","status"}, new int[] { R.id.info_txt_left,R.id.info_txt_middle,R.id.info_txt_right});
//    	ListAdapter listAdapter=new SimpleAdapter(context,list, R.layout.info_content_item,
//    			new String[] {  "time", "address","status"}, new int[] {R.id.info_txt_left,R.id.info_txt_middle,R.id.info_txt_right});
    	ListAdapter listAdapter=new SimpleAdapter(context,list, R.layout.info_content_item_linear,
    			new String[] {  "time", "address","status"}, new int[] {R.id.info_txt_left,R.id.info_txt_middle,R.id.info_txt_right});
//		System.out.println("InfoAdapter--50");
		return listAdapter;
	}
	
	public ListAdapter setListView4Cost3() {
		// TODO Auto-generated method stub
    	ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
    	for (int i = 0; i < post4pxInfos.size(); i++) {
    		post4pxInfo=new Post4pxInfo();
    		post4pxInfo=(Post4pxInfo) post4pxInfos.get(i);
//    		do {
    			HashMap<String, String> map = new HashMap<String, String>();
	    		map.put("time", post4pxInfo.getTime());
	    		map.put("address", post4pxInfo.getAddress());
	    		map.put("status", post4pxInfo.getStatus());
//	    		System.out.println("InfoAdapter--setListView4Cost3--65--"+post4pxInfo.toString());
	    		list.add(map);
//    		}while(false);
		}
    	ListAdapter listAdapter=new SimpleAdapter(context,list, R.layout.info_content_item_coat3_linear,
    			new String[] {  "time", "address","status"}, new int[] {R.id.info_txt_left_cost3,R.id.info_txt_middle_cost3,R.id.info_txt_right_cost3});
//    	ListAdapter listAdapter=new SimpleAdapter(context,list, R.layout.cost3info_content_item_inner,
//    			new String[] {  "time", "address","status"}, new int[] {R.id.cost3_info_txt_left,R.id.cost3_info_txt_middle,R.id.cost3_info_txt_right});
//    	System.out.println("InfoAdapter--50");
    	
    	return listAdapter;
	}
}
